<?php
/*
 * configure all forms here for the router to check
 * basic form configuration array
 * array(
		'form_ident'=> 'addArticle',
		'form_ident_alias'=> 'addArticleFormAlias',
		'form_fields'=> array(
			array(
				'field_set_id'=> 'test_field_set_a',
				'fields'=> array(
					array(
						'input_name'=> '',
						'input_id'=> '',
						'input_type'=> '',
						'radio_button_group'=> '',
						'default_value'=> ''
					)
			)
		),
		'submit_button'=> array(
			'value'=> 'submit',
			'id'=> 'addArticleFormSubmit'
		),
		'action'=> 'index.php',
		'method'=> 'post',
		'form_handler_class'=> 'ManageArticlesController',
		'form_handler_class_method'=> 'handleAddArticleForm'
	)
 */
$s_formIdentField = fw_util_encrypt('identifier', 5);
$s_formPostSubmitHandlerField = fw_util_encrypt('formTimeStamp'. $s_formIdentField, 10);
$s_formSessionArraySubmitHandler = 'submitHandlerArray';

$arr_forms = array(
	//login form configuration array
	array(
		'form_ident'=> 'login-form',
		'form_ident_alias'=> fw_util_encrypt('login-form-alias', 15),
		'form_handler_class'=> 'LoginController',
		'form_handler_class_method'=> 'handleLoginFormSubmit',
		'action'=> fw_util_getCurrUrl(),
		'method'=> 'POST', 
		'multipart'=> false, 
		'form_id'=> 'login-form-id', 
		'form_line_elem'=> 'p',
		'form_name'=> 'login-form',
		'field_sets'=> array(
			array(
				'field_set_id'=> 'user-credentials',
				'field_set_legend'=> 'login form',
				'inline_errors'=> false,
				'fields'=> array(
					array(
						'field_id'=> 'username',
						'label'=> 'username', 
						'name'=> 'username', 
						'value'=> '', 
						'minLength'=> 5, 
						'maxLength'=> 50, 
						'type'=> 'text', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					),
					
					array(
						'field_id'=> 'user-password',
						'label'=> 'password', 
						'name'=> 'user-password', 
						'value'=> '', 
						'minLength'=> 5, 
						'maxLength'=> 50, 
						'type'=> 'password', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					),
					
					array(
						'field_id'=> 'login-submit-button',
						'label'=> '', 
						'name'=> 'login-submit-button', 
						'value'=> 'login', 
						'minLength'=> 5, 
						'maxLength'=> 5, 
						'type'=> 'submit', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'alpha', 'error_message'=> 'letters only please')
						)
					)
				)
			)
		)
	),
	
	//add article form configuration array
	array(
		'form_ident'=> 'addArticle',
		'form_ident_alias'=> fw_util_encrypt('addArticleFormAlias', 12),
		'form_handler_class'=> 'ManageArticlesController',
		'form_handler_class_method'=> 'handleAddArticleForm',
		'action'=> fw_util_getCurrUrl(),
		'method'=> 'POST', 
		'multipart'=> false, 
		'form_id'=> 'add-article-form-id', 
		'form_line_elem'=> 'p',
		'form_name'=> 'addArticleForm',
		'field_sets'=> array(
			array(
				'field_set_id'=> 'add-article-form-fieldset-1',
				'field_set_legend'=> 'add an article',
				'inline_errors'=> false,
				'fields'=> array(
					array(
						'field_id'=> 'articleTitle',
						'label'=> 'article title', 
						'name'=> 'articleTitle', 
						'value'=> '', 
						'minLength'=> 1, 
						'maxLength'=> 50, 
						'type'=> 'text', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					),
						
					array(
						'field_id'=> 'articleContent',
						'label'=> 'article content', 
						'name'=> 'articleContent', 
						'value'=> '', 
						'minLength'=> 1, 
						'maxLength'=> '1000', 
						'type'=> 'textarea', 
						'default'=> false,
						'rules'=> 	array()
					),
						
					array(
						'field_id'=> 'add-article-submit',
						'label'=> '', 
						'name'=> 'add-article-submit', 
						'value'=> 'add article', 
						'minLength'=> 11, 
						'maxLength'=> 11, 
						'type'=> 'submit', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					)
				)
			)
		)
	),

	
	//update article form configuration array
	array(
		'form_ident'=> 'updateArticle',
		'form_ident_alias'=> fw_util_encrypt('updateArticleFormAlias', 12),
		'form_handler_class'=> 'ManageArticlesController',
		'form_handler_class_method'=> 'handleUpdateArticleForm',
		'action'=> fw_util_getCurrUrl(),
		'method'=> 'POST', 
		'multipart'=> false, 
		'form_id'=> 'updateArticleForm', 
		'form_line_elem'=> 'p',
		'form_name'=> 'updateArticleForm',
		'field_sets'=> array(
			array(
				'field_set_id'=> 'update-article-form-fieldset-1',
				'field_set_legend'=> 'update this article',
				'inline_errors'=> false,
				'fields'=> array(
					array(
						'field_id'=> 'articleTitle',
						'label'=> 'article title', 
						'name'=> 'articleTitle', 
						'value'=> '', 
						'minLength'=> 1, 
						'maxLength'=> 50, 
						'type'=> 'text', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					),
					
					array(
						'field_id'=> 'articleContent',
						'label'=> 'article content', 
						'name'=> 'articleContent', 
						'value'=> '', 
						'minLength'=> 1, 
						'maxLength'=> '1000', 
						'type'=> 'textarea', 
						'default'=> false,
						'rules'=> 	array()
					),
					
					array(
						'field_id'=> 'articleId',
						'label'=> '', 
						'name'=> 'articleId', 
						'value'=> '', 
						'minLength'=> 1, 
						'maxLength'=> '50', 
						'type'=> 'hidden', 
						'default'=> false,
						'rules'=> 	array(array('validate'=>'required', 'error_message'=> 'required value'))
					),
					
					array(
						'field_id'=> 'update-article-submit',
						'label'=> '', 
						'name'=> 'update-article-submit', 
						'value'=> 'update article', 
						'minLength'=> 11, 
						'maxLength'=> 11, 
						'type'=> 'submit', 
						'default'=> false,
						'rules'=> 	array(
							array('validate'=>'required', 'error_message'=> 'required value')
						)
					)
				)
			)
		)
	),	
	
);
?>